home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / COMMON / TOOLS / VCM / VCM.MDB / VcmComponentContainer / 14_Cabinet / DBVIEWER.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-18  |  4.2 KB  |  166 lines

  1. // DBViewer.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes and
  4. // Templates (MFC&T).
  5. // Copyright (C) 1998 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // MFC&T Reference and related electronic documentation provided
  10. // with the library.  See these sources for detailed information
  11. // regarding the MFC&T product.
  12. //
  13.  
  14. #include "stdafx.h"
  15. #include "DBViewer.h"
  16.  
  17. #include "MainFrm.h"
  18.  
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CDBViewApp
  27.  
  28. BEGIN_MESSAGE_MAP(CDBViewApp, CWinApp)
  29.     //{{AFX_MSG_MAP(CDBViewApp)
  30.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  31.         // NOTE - the ClassWizard will add and remove mapping macros here.
  32.         //    DO NOT EDIT what you see in these blocks of generated code!
  33.     //}}AFX_MSG_MAP
  34.     // Standard file based document commands
  35.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  36. END_MESSAGE_MAP()
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CDBViewApp construction
  40.  
  41. CDBViewApp::CDBViewApp()
  42. {
  43.     m_bShowSystemObjects = FALSE;
  44.     m_bShowWarnings = TRUE;
  45.     m_bOpenODBC = FALSE;
  46.     m_nMaxRecords = 100;
  47. }
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // The one and only CDBViewApp object
  51.  
  52. CDBViewApp theApp;
  53.  
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CDBViewApp initialization
  56.  
  57. BOOL CDBViewApp::InitInstance()
  58. {
  59.     if (!AfxOleInit())
  60.     {
  61.         AfxMessageBox(_T("Ole Initialization Failed"));
  62.         return FALSE;
  63.     }
  64.  
  65.     // Standard initialization
  66.     // If you are not using these features and wish to reduce the size
  67.     //  of your final executable, you should remove from the following
  68.     //  the specific initialization routines you do not need.
  69.  
  70. #ifdef _AFXDLL
  71.     Enable3dControls();         // Call this when using MFC in a shared DLL
  72. #else
  73.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  74. #endif
  75.  
  76.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  77.  
  78.     // Register the application's document templates.  Document templates
  79.     //  serve as the connection between documents, frame windows and views.
  80.  
  81.     CSingleDocTemplate* pDocTemplate;
  82.     pDocTemplate = new CSingleDocTemplate(
  83.         IDR_MAINFRAME,
  84.         RUNTIME_CLASS(CDBViewDoc),
  85.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  86.         RUNTIME_CLASS(CDBTreeView));
  87.     AddDocTemplate(pDocTemplate);
  88.  
  89.     // Enable DDE Execute Open
  90.     EnableShellOpen();
  91.     RegisterShellFileTypes(TRUE);
  92.  
  93.     // Parse command line for standard shell commands, DDE, file open
  94.     CCommandLineInfo cmdInfo;
  95.     ParseCommandLine(cmdInfo);
  96.  
  97.     // Dispatch commands specified on the command line
  98.     if (!ProcessShellCommand(cmdInfo))
  99.         return FALSE;
  100.  
  101.     // Enable drag/drop open
  102.     m_pMainWnd->DragAcceptFiles();
  103.  
  104.     return TRUE;
  105. }
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CAboutDlg dialog used for App About
  109.  
  110. class CAboutDlg : public CDialog
  111. {
  112. public:
  113.     CAboutDlg();
  114.  
  115. // Dialog Data
  116.     //{{AFX_DATA(CAboutDlg)
  117.     enum { IDD = IDD_ABOUTBOX };
  118.     //}}AFX_DATA
  119.  
  120.     // ClassWizard generated virtual function overrides
  121.     //{{AFX_VIRTUAL(CAboutDlg)
  122.     protected:
  123.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  124.     //}}AFX_VIRTUAL
  125.  
  126. // Implementation
  127. protected:
  128.     //{{AFX_MSG(CAboutDlg)
  129.         // No message handlers
  130.     //}}AFX_MSG
  131.     DECLARE_MESSAGE_MAP()
  132. };
  133.  
  134. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  135. {
  136.     //{{AFX_DATA_INIT(CAboutDlg)
  137.     //}}AFX_DATA_INIT
  138. }
  139.  
  140. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  141. {
  142.     CDialog::DoDataExchange(pDX);
  143.     //{{AFX_DATA_MAP(CAboutDlg)
  144.     //}}AFX_DATA_MAP
  145. }
  146.  
  147. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  148.     //{{AFX_MSG_MAP(CAboutDlg)
  149.         // No message handlers
  150.     //}}AFX_MSG_MAP
  151. END_MESSAGE_MAP()
  152.  
  153. // App command to run the dialog
  154. void CDBViewApp::OnAppAbout()
  155. {
  156.     CAboutDlg aboutDlg;
  157.     aboutDlg.DoModal();
  158. }
  159.  
  160. /////////////////////////////////////////////////////////////////////////////
  161. // CDBViewApp commands
  162.  
  163.  
  164.  
  165. /////////////////////////////////////////////////////////////////////////////
  166.